import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user'
import common from './modules/common'
import tags from './modules/tags'
import logs from './modules/logs'
import dict from './modules/dict'
import tabs from './modules/tabs'
import getters from './getters'
// import Underline from 'wangeditor/dist/menus/underline'
// import createPersistedState from "vuex-persistedstate"

Vue.use(Vuex)
const store = new Vuex.Store({
    state: {
        pageStyle: '2',
        promoterDrawer: false,
        flowPermission: [],
        approverDrawer: false,
        approverConfig: {},
        copyerDrawer: false,
        copyerConfig: {},
        conditionDrawer: false,
        conditionsConfig: {
            conditionNodes: [],
        },//这个用来记录正在编辑的表单数据。
    },
    mutations: {
        updatepageStyle(state, data) {
            state.pageStyle = data
        },
        updatePromoter(status, promoterDrawer) {
            status.promoterDrawer = promoterDrawer
        },
        updateFlowPermission(status, flowPermission) {
            status.flowPermission = flowPermission
        },
        updateApprover(status, approverDrawer) {
            status.approverDrawer = approverDrawer
        },
        updateApproverConfig(status, approverConfig) {
            status.approverConfig = approverConfig
        },
        updateCopyer(status, copyerDrawer) {
            status.copyerDrawer = copyerDrawer
        },
        updateCopyerConfig(status, copyerConfig) {
            status.copyerConfig = copyerConfig
        },
        updateCondition(status, conditionDrawer) {
            status.conditionDrawer = conditionDrawer
        },
        updateConditionsConfig(status, conditionsConfig) {
            status.conditionsConfig = conditionsConfig
        },     
    },
    modules: {
        user,
        common,
        logs,
        tags,
        dict,
        tabs
    },
    getters,
     // plugins: [createPersistedState()]
})

export default store
